<template>
  <div class="Top">
    <div class="Left">
      <span class="leftBtn" @click="goHome">首页</span>
    </div>
    <div class="Center">
      <div class="title">智慧旅游可视化大数据平台</div>
    </div>
    <div class="Right">
      <span class="rightBtn">统计报告</span>
      <span class="time">{{ time }}</span>
    </div>
  </div>
</template>

<script lang="ts" setup name="Top">
import moment from 'moment'
import { onBeforeMount, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
let $router = useRouter()
let time = ref(moment().format('YYYY年MM月DD日 hh:mm:ss'))
let timer = ref(0)
const goHome = () => {
  $router.push('/home')
}
onMounted(() => {
  timer.value = setInterval(() => {
    time.value = moment().format('YYYY年MM月DD日 hh:mm:ss')
  }, 1000)
})
onBeforeMount(() => {
  clearInterval(timer.value)
})
</script>

<style scoped>
.Top {
  width: 100%;
  height: 40px;
  display: flex;

  .Left {
    flex: 1;
    background: url(../../images/dataScreen-header-left-bg.png) no-repeat;
    background-size: cover;

    .leftBtn {
      width: 150px;
      height: 100%;
      float: right;
      background: url(../../images/dataScreen-header-btn-bg-l.png) no-repeat;
      background-size: 100% 100%;
      text-align: center;
      line-height: 35px;
      color: #29fcff;
      font-size: 18px;
    }
  }
  .Center {
    flex: 1.5;
    .title {
      width: 100%;
      height: 75px;
      background: url(../../images/dataScreen-header-center-bg.png) no-repeat;
      background-size: 100% 100%;
      text-align: center;

      line-height: 65px;
      color: #29fcff;
      font-size: 30px;
    }
  }
  .Right {
    flex: 1;
    background: url(../../images/dataScreen-header-left-bg.png) no-repeat;
    background-size: cover;
    display: flex;
    justify-content: space-between;
    line-height: 35px;

    .rightBtn {
      width: 150px;
      height: 100%;
      float: left;
      align-items: center;
      background: url(../../images/dataScreen-header-btn-bg-r.png) no-repeat;
      background-size: 100% 100%;
      text-align: center;
      color: #29fcff;
      font-size: 18px;
    }
    .time {
      color: #29fcff;
      font-size: 18px;
    }
  }
}
</style>
